Skip to content

Add server token retrieval feature to dashboard#49

Open
Th0rgal wants to merge 1 commit intomasterfrom
Th0rgal/show-token-dashboard
Open

Add server token retrieval feature to dashboard#49
Th0rgal wants to merge 1 commit intomasterfrom
Th0rgal/show-token-dashboard

Conversation

@Th0rgal
Copy link
Copy Markdown
Member

@Th0rgal Th0rgal commented Dec 28, 2025

Summary

Users can now view and copy their server authentication token from the dashboard settings page. The token is stored when servers are registered and displayed with show/hide and copy-to-clipboard functionality.

Changes

  • New /api/servers/[id]/token endpoint to retrieve stored tokens
  • Authentication Token section in dashboard settings with reveal, show/hide, and copy buttons
  • Tokens automatically stored during server registration via the register endpoint

How it works

  1. When linking a server, the plain token is stored in the database
  2. Users can visit Settings and click "Reveal Token" to fetch it on-demand
  3. Show/hide toggle masks sensitive data, and copy button makes integration easier

Note

Enables viewing and copying a server auth token from the dashboard, with backend support to fetch stored tokens securely.

  • New GET /api/servers/[id]/token reads servers.auth_token with auth/ownership checks and clear error responses when unavailable
  • POST /api/servers/register now persists plain auth_token alongside existing data so it can be retrieved later
  • Settings UI adds an Authentication Token section with on-demand fetch (Reveal Token), show/hide masking, and copy-to-clipboard with feedback in app/(dashboard)/dashboard/settings/page.tsx

Written by Cursor Bugbot for commit dc8df6e. This will update automatically on new commits. Configure here.

Users can now view and copy their server authentication token from the dashboard settings page. The token is stored when servers are linked and can be revealed with a show/hide toggle. This enables users to retrieve their token without needing direct access to the plugin configuration.
@vercel
Copy link
Copy Markdown

vercel bot commented Dec 28, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
asyncanticheat.com Ready Ready Preview, Comment Dec 28, 2025 9:03am

const [tokenLoading, setTokenLoading] = useState(false);
const [tokenError, setTokenError] = useState<string | null>(null);
const [showToken, setShowToken] = useState(false);
const [copied, setCopied] = useState(false);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Token state persists when switching between servers

The token-related state (token, tokenError, showToken, copied) is not reset when serverId changes. When a user reveals a token for one server, then switches to a different server via the sidebar, the previous server's token remains displayed. This could cause users to copy and use the wrong server's authentication token. Other pages like the modules page properly reset their state when the selected server changes.

Additional Locations (1)

Fix in Cursor Fix in Web

const update: Record<string, unknown> = {
owner_user_id: user.id,
registered_at: new Date().toISOString(),
auth_token: token, // Store plain token so user can retrieve it later
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Authentication tokens stored in plaintext in database

Authentication tokens are stored in plaintext in the auth_token column. While the system already uses auth_token_hash for server lookups, storing the raw token means a database breach would expose all server authentication credentials. An attacker with database access could impersonate any registered server. Consider whether the token retrieval feature justifies this risk, or explore alternatives like encrypted storage with a separate key.

Additional Locations (1)

Fix in Cursor Fix in Web

<RiAlertLine className="h-4 w-4" />
{tokenError}
</div>
)}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No retry option after token load failure

When token loading fails and tokenError is set, the "Reveal Token" button becomes hidden because the condition token === null && !tokenLoading && !tokenError evaluates to false. The error message is displayed, but users have no way to retry the request without refreshing the entire page. The !tokenError part of the condition prevents the button from appearing when an error exists.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant